import win32api
import win32con
import datetime
import time

timeCur = datetime.datetime.now()

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


def main():
    print_hi('PyCharm')
    print_hi('time:{}'.format(timeCur.timestamp()))
    timeYesterdayStr = datetime.datetime.fromtimestamp(timeCur.timestamp()-60*60*24).strftime('%Y-%m-%d')
    timeYesterdayStr = timeYesterdayStr + '  09:00:00'
    timeTodayStr = '{}-{}-{} 09:00:00'.format(timeCur.year, timeCur.month, timeCur.day)
    print_hi('昨天：{}    今天：{}'.format(timeYesterdayStr, timeTodayStr))
    timeYesterday = time.strptime(timeYesterdayStr, '%Y-%m-%d %H:%M:%S')
    timeToday = time.strptime(timeTodayStr, '%Y-%m-%d %H:%M:%S')
    print_hi('昨天：{}    今天：{}'.format(int(time.mktime(timeYesterday)), int(time.mktime(timeToday))))
    time.sleep(5)
    for index in range(1, 1000):
        # win32api.SetCursorPos((100, 100))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
        print_hi('点击次数：{}  time:{} -1'.format(index, timeCur))
        time.sleep(300)
        # win32api.SetCursorPos((200, 200))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
        print_hi('点击次数：{}  time:{} -2'.format(index, timeCur))


if __name__ == '__main__':
    main()


